3.1.12 \(\int (a g+b g x)^2 (A+B \log (e (\frac {a+b x}{c+d x})^n))^2 \, dx\) [12]

3.1.12.1 Optimal result
3.1.12.2 Mathematica [A] (verified)
3.1.12.3 Rubi [A] (verified)
3.1.12.4 Maple [F]
3.1.12.5 Fricas [F]
3.1.12.6 Sympy [F(-1)]
3.1.12.7 Maxima [B] (verification not implemented)
3.1.12.8 Giac [F]
3.1.12.9 Mupad [F(-1)]

3.1.12.1 Optimal result

Integrand size = 35, antiderivative size = 274 \[ \int (a g+b g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \, dx=-\frac {B (b c-a d) g^2 n (a+b x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{3 b d}+\frac {g^2 (a+b x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{3 b}+\frac {B (b c-a d)^2 g^2 n (a+b x) \left (2 A+B n+2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{3 b d^2}+\frac {B (b c-a d)^3 g^2 n \left (2 A+3 B n+2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \log \left (\frac {b c-a d}{b (c+d x)}\right )}{3 b d^3}+\frac {2 B^2 (b c-a d)^3 g^2 n^2 \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{3 b d^3} \]

output
-1/3*B*(-a*d+b*c)*g^2*n*(b*x+a)^2*(A+B*ln(e*((b*x+a)/(d*x+c))^n))/b/d+1/3* 
g^2*(b*x+a)^3*(A+B*ln(e*((b*x+a)/(d*x+c))^n))^2/b+1/3*B*(-a*d+b*c)^2*g^2*n 
*(b*x+a)*(2*A+B*n+2*B*ln(e*((b*x+a)/(d*x+c))^n))/b/d^2+1/3*B*(-a*d+b*c)^3* 
g^2*n*(2*A+3*B*n+2*B*ln(e*((b*x+a)/(d*x+c))^n))*ln((-a*d+b*c)/b/(d*x+c))/b 
/d^3+2/3*B^2*(-a*d+b*c)^3*g^2*n^2*polylog(2,d*(b*x+a)/b/(d*x+c))/b/d^3
 
3.1.12.2 Mathematica [A] (verified)

Time = 0.16 (sec) , antiderivative size = 303, normalized size of antiderivative = 1.11 \[ \int (a g+b g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \, dx=\frac {g^2 \left ((a+b x)^3 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2+\frac {B (b c-a d) n \left (2 A b d (b c-a d) x+2 B d (b c-a d) (a+b x) \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )-d^2 (a+b x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )-2 B (b c-a d)^2 n \log (c+d x)-2 (b c-a d)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \log (c+d x)+B (b c-a d) n (b d x+(-b c+a d) \log (c+d x))+B (b c-a d)^2 n \left (\left (2 \log \left (\frac {d (a+b x)}{-b c+a d}\right )-\log (c+d x)\right ) \log (c+d x)+2 \operatorname {PolyLog}\left (2,\frac {b (c+d x)}{b c-a d}\right )\right )\right )}{d^3}\right )}{3 b} \]

input
Integrate[(a*g + b*g*x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n])^2,x]
 
output
(g^2*((a + b*x)^3*(A + B*Log[e*((a + b*x)/(c + d*x))^n])^2 + (B*(b*c - a*d 
)*n*(2*A*b*d*(b*c - a*d)*x + 2*B*d*(b*c - a*d)*(a + b*x)*Log[e*((a + b*x)/ 
(c + d*x))^n] - d^2*(a + b*x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n]) - 2 
*B*(b*c - a*d)^2*n*Log[c + d*x] - 2*(b*c - a*d)^2*(A + B*Log[e*((a + b*x)/ 
(c + d*x))^n])*Log[c + d*x] + B*(b*c - a*d)*n*(b*d*x + (-(b*c) + a*d)*Log[ 
c + d*x]) + B*(b*c - a*d)^2*n*((2*Log[(d*(a + b*x))/(-(b*c) + a*d)] - Log[ 
c + d*x])*Log[c + d*x] + 2*PolyLog[2, (b*(c + d*x))/(b*c - a*d)])))/d^3))/ 
(3*b)
 
3.1.12.3 Rubi [A] (verified)

Time = 0.67 (sec) , antiderivative size = 309, normalized size of antiderivative = 1.13, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.171, Rules used = {2949, 2781, 2784, 2784, 2754, 2838}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a g+b g x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2 \, dx\)

\(\Big \downarrow \) 2949

\(\displaystyle g^2 (b c-a d)^3 \int \frac {(a+b x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{(c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^4}d\frac {a+b x}{c+d x}\)

\(\Big \downarrow \) 2781

\(\displaystyle g^2 (b c-a d)^3 \left (\frac {(a+b x)^3 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{3 b (c+d x)^3 \left (b-\frac {d (a+b x)}{c+d x}\right )^3}-\frac {2 B n \int \frac {(a+b x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{(c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^3}d\frac {a+b x}{c+d x}}{3 b}\right )\)

\(\Big \downarrow \) 2784

\(\displaystyle g^2 (b c-a d)^3 \left (\frac {(a+b x)^3 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{3 b (c+d x)^3 \left (b-\frac {d (a+b x)}{c+d x}\right )^3}-\frac {2 B n \left (\frac {(a+b x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{2 d (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {\int \frac {(a+b x) \left (2 A+B n+2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{(c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )^2}d\frac {a+b x}{c+d x}}{2 d}\right )}{3 b}\right )\)

\(\Big \downarrow \) 2784

\(\displaystyle g^2 (b c-a d)^3 \left (\frac {(a+b x)^3 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{3 b (c+d x)^3 \left (b-\frac {d (a+b x)}{c+d x}\right )^3}-\frac {2 B n \left (\frac {(a+b x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{2 d (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {\frac {(a+b x) \left (2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+2 A+B n\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {\int \frac {2 A+3 B n+2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b-\frac {d (a+b x)}{c+d x}}d\frac {a+b x}{c+d x}}{d}}{2 d}\right )}{3 b}\right )\)

\(\Big \downarrow \) 2754

\(\displaystyle g^2 (b c-a d)^3 \left (\frac {(a+b x)^3 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{3 b (c+d x)^3 \left (b-\frac {d (a+b x)}{c+d x}\right )^3}-\frac {2 B n \left (\frac {(a+b x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{2 d (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {\frac {(a+b x) \left (2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+2 A+B n\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {\frac {2 B n \int \frac {(c+d x) \log \left (1-\frac {d (a+b x)}{b (c+d x)}\right )}{a+b x}d\frac {a+b x}{c+d x}}{d}-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+2 A+3 B n\right )}{d}}{d}}{2 d}\right )}{3 b}\right )\)

\(\Big \downarrow \) 2838

\(\displaystyle g^2 (b c-a d)^3 \left (\frac {(a+b x)^3 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{3 b (c+d x)^3 \left (b-\frac {d (a+b x)}{c+d x}\right )^3}-\frac {2 B n \left (\frac {(a+b x)^2 \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{2 d (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {\frac {(a+b x) \left (2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+2 A+B n\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (2 B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+2 A+3 B n\right )}{d}-\frac {2 B n \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{d}}{d}}{2 d}\right )}{3 b}\right )\)

input
Int[(a*g + b*g*x)^2*(A + B*Log[e*((a + b*x)/(c + d*x))^n])^2,x]
 
output
(b*c - a*d)^3*g^2*(((a + b*x)^3*(A + B*Log[e*((a + b*x)/(c + d*x))^n])^2)/ 
(3*b*(c + d*x)^3*(b - (d*(a + b*x))/(c + d*x))^3) - (2*B*n*(((a + b*x)^2*( 
A + B*Log[e*((a + b*x)/(c + d*x))^n]))/(2*d*(c + d*x)^2*(b - (d*(a + b*x)) 
/(c + d*x))^2) - (((a + b*x)*(2*A + B*n + 2*B*Log[e*((a + b*x)/(c + d*x))^ 
n]))/(d*(c + d*x)*(b - (d*(a + b*x))/(c + d*x))) - (-(((2*A + 3*B*n + 2*B* 
Log[e*((a + b*x)/(c + d*x))^n])*Log[1 - (d*(a + b*x))/(b*(c + d*x))])/d) - 
 (2*B*n*PolyLog[2, (d*(a + b*x))/(b*(c + d*x))])/d)/d)/(2*d)))/(3*b))
 

3.1.12.3.1 Defintions of rubi rules used

rule 2754
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symb 
ol] :> Simp[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^p/e), x] - Simp[b*n*(p/e) 
  Int[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[{a, 
b, c, d, e, n}, x] && IGtQ[p, 0]
 

rule 2781
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((f_.)*(x_))^(m_.)*((d_) + 
(e_.)*(x_))^(q_), x_Symbol] :> Simp[(-(f*x)^(m + 1))*(d + e*x)^(q + 1)*((a 
+ b*Log[c*x^n])^p/(d*f*(q + 1))), x] + Simp[b*n*(p/(d*(q + 1)))   Int[(f*x) 
^m*(d + e*x)^(q + 1)*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{a, b, c, 
d, e, f, m, n, q}, x] && EqQ[m + q + 2, 0] && IGtQ[p, 0] && LtQ[q, -1]
 

rule 2784
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((f_.)*(x_))^(m_.)*((d_) + (e_.)* 
(x_))^(q_.), x_Symbol] :> Simp[(f*x)^m*(d + e*x)^(q + 1)*((a + b*Log[c*x^n] 
)/(e*(q + 1))), x] - Simp[f/(e*(q + 1))   Int[(f*x)^(m - 1)*(d + e*x)^(q + 
1)*(a*m + b*n + b*m*Log[c*x^n]), x], x] /; FreeQ[{a, b, c, d, e, f, m, n}, 
x] && ILtQ[q, -1] && GtQ[m, 0]
 

rule 2838
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 
, (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
 

rule 2949
Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*( 
B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(b*c - a*d)^(m + 
1)*(g/b)^m   Subst[Int[x^m*((A + B*Log[e*x^n])^p/(b - d*x)^(m + 2)), x], x, 
 (a + b*x)/(c + d*x)], x] /; FreeQ[{a, b, c, d, e, f, g, A, B, n}, x] && Ne 
Q[b*c - a*d, 0] && IntegersQ[m, p] && EqQ[b*f - a*g, 0] && (GtQ[p, 0] || Lt 
Q[m, -1])
 
3.1.12.4 Maple [F]

\[\int \left (b g x +a g \right )^{2} {\left (A +B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right )\right )}^{2}d x\]

input
int((b*g*x+a*g)^2*(A+B*ln(e*((b*x+a)/(d*x+c))^n))^2,x)
 
output
int((b*g*x+a*g)^2*(A+B*ln(e*((b*x+a)/(d*x+c))^n))^2,x)
 
3.1.12.5 Fricas [F]

\[ \int (a g+b g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \, dx=\int { {\left (b g x + a g\right )}^{2} {\left (B \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right ) + A\right )}^{2} \,d x } \]

input
integrate((b*g*x+a*g)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n))^2,x, algorithm="f 
ricas")
 
output
integral(A^2*b^2*g^2*x^2 + 2*A^2*a*b*g^2*x + A^2*a^2*g^2 + (B^2*b^2*g^2*x^ 
2 + 2*B^2*a*b*g^2*x + B^2*a^2*g^2)*log(e*((b*x + a)/(d*x + c))^n)^2 + 2*(A 
*B*b^2*g^2*x^2 + 2*A*B*a*b*g^2*x + A*B*a^2*g^2)*log(e*((b*x + a)/(d*x + c) 
)^n), x)
 
3.1.12.6 Sympy [F(-1)]

Timed out. \[ \int (a g+b g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \, dx=\text {Timed out} \]

input
integrate((b*g*x+a*g)**2*(A+B*ln(e*((b*x+a)/(d*x+c))**n))**2,x)
 
output
Timed out
 
3.1.12.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1501 vs. \(2 (263) = 526\).

Time = 0.69 (sec) , antiderivative size = 1501, normalized size of antiderivative = 5.48 \[ \int (a g+b g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \, dx=\text {Too large to display} \]

input
integrate((b*g*x+a*g)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n))^2,x, algorithm="m 
axima")
 
output
2/3*A*B*b^2*g^2*x^3*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + 1/3*A^2*b^2*g 
^2*x^3 + 2*A*B*a*b*g^2*x^2*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + A^2*a* 
b*g^2*x^2 + 1/3*A*B*b^2*g^2*n*(2*a^3*log(b*x + a)/b^3 - 2*c^3*log(d*x + c) 
/d^3 - ((b^2*c*d - a*b*d^2)*x^2 - 2*(b^2*c^2 - a^2*d^2)*x)/(b^2*d^2)) - 2* 
A*B*a*b*g^2*n*(a^2*log(b*x + a)/b^2 - c^2*log(d*x + c)/d^2 + (b*c - a*d)*x 
/(b*d)) + 2*A*B*a^2*g^2*n*(a*log(b*x + a)/b - c*log(d*x + c)/d) + 2*A*B*a^ 
2*g^2*x*log(e*(b*x/(d*x + c) + a/(d*x + c))^n) + A^2*a^2*g^2*x - 1/3*((3*g 
^2*n^2 + 2*g^2*n*log(e))*b^2*c^3 - (7*g^2*n^2 + 6*g^2*n*log(e))*a*b*c^2*d 
+ 2*(2*g^2*n^2 + 3*g^2*n*log(e))*a^2*c*d^2)*B^2*log(d*x + c)/d^3 - 2/3*(b^ 
3*c^3*g^2*n^2 - 3*a*b^2*c^2*d*g^2*n^2 + 3*a^2*b*c*d^2*g^2*n^2 - a^3*d^3*g^ 
2*n^2)*(log(b*x + a)*log((b*d*x + a*d)/(b*c - a*d) + 1) + dilog(-(b*d*x + 
a*d)/(b*c - a*d)))*B^2/(b*d^3) + 1/3*(B^2*b^3*d^3*g^2*x^3*log(e)^2 - B^2*a 
^3*d^3*g^2*n^2*log(b*x + a)^2 - (b^3*c*d^2*g^2*n*log(e) - (g^2*n*log(e) + 
3*g^2*log(e)^2)*a*b^2*d^3)*B^2*x^2 + 2*(b^3*c^3*g^2*n^2 - 3*a*b^2*c^2*d*g^ 
2*n^2 + 3*a^2*b*c*d^2*g^2*n^2)*B^2*log(b*x + a)*log(d*x + c) - (b^3*c^3*g^ 
2*n^2 - 3*a*b^2*c^2*d*g^2*n^2 + 3*a^2*b*c*d^2*g^2*n^2)*B^2*log(d*x + c)^2 
+ ((g^2*n^2 + 2*g^2*n*log(e))*b^3*c^2*d - 2*(g^2*n^2 + 3*g^2*n*log(e))*a*b 
^2*c*d^2 + (g^2*n^2 + 4*g^2*n*log(e) + 3*g^2*log(e)^2)*a^2*b*d^3)*B^2*x + 
(2*a*b^2*c^2*d*g^2*n^2 - 5*a^2*b*c*d^2*g^2*n^2 + (3*g^2*n^2 + 2*g^2*n*log( 
e))*a^3*d^3)*B^2*log(b*x + a) + (B^2*b^3*d^3*g^2*x^3 + 3*B^2*a*b^2*d^3*...
 
3.1.12.8 Giac [F]

\[ \int (a g+b g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \, dx=\int { {\left (b g x + a g\right )}^{2} {\left (B \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right ) + A\right )}^{2} \,d x } \]

input
integrate((b*g*x+a*g)^2*(A+B*log(e*((b*x+a)/(d*x+c))^n))^2,x, algorithm="g 
iac")
 
output
integrate((b*g*x + a*g)^2*(B*log(e*((b*x + a)/(d*x + c))^n) + A)^2, x)
 
3.1.12.9 Mupad [F(-1)]

Timed out. \[ \int (a g+b g x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \, dx=\int {\left (a\,g+b\,g\,x\right )}^2\,{\left (A+B\,\ln \left (e\,{\left (\frac {a+b\,x}{c+d\,x}\right )}^n\right )\right )}^2 \,d x \]

input
int((a*g + b*g*x)^2*(A + B*log(e*((a + b*x)/(c + d*x))^n))^2,x)
 
output
int((a*g + b*g*x)^2*(A + B*log(e*((a + b*x)/(c + d*x))^n))^2, x)